<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>网站配置 - 系统配置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="__XADM_CSS__/font.css">
    <link rel="stylesheet" href="__XADM_CSS__/xadmin.css">
    <script src="__XADM_LIB__/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__XADM_JS__/xadmin.js"></script>
    <style type="text/css">
        .page .num {
            margin-left: 2px;
        }
        .layui-form-item .layui-input-inline{
            width: 250px;
        }
    </style>
</head>

<body>
   
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-row">
                    <form class="layui-form" method="post" enctype="multipart/form-data">
                        <div class="layui-form-item">
                            <label for="site_name" class="layui-form-label">
                                <span class="x-red">*</span>网站名称</label>
                            <div class="layui-input-inline">
                                <input type="text" id="site_name" name="site_name" required="" lay-verify="title" autocomplete="off" class="layui-input" value="{$siteinfo.site_name}"></div>
                        </div>
                        <div class="layui-form-item">
                            <label for="site_keywords" class="layui-form-label">网站关键词</label>
                            <div class="layui-input-inline">
                                <input type="text" id="site_keywords" name="site_keywords" required=""
                                    lay-verify="title" autocomplete="off" class="layui-input"
                                    value="{$siteinfo.site_keywords}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="site_description" class="layui-form-label">网站描述</label>
                            <div class="layui-input-inline">
                                <input type="text" id="site_description" name="site_description" required=""
                                    lay-verify="title" autocomplete="off" class="layui-input"
                                    value="{$siteinfo.site_description}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="allow_register" class="layui-form-label">
                                开启注册</label>
                            <div class="layui-input-inline">
                                关闭 <input type="radio" name="allow_register" value="2" {if $siteinfo['allow_register'] == 2} checked="checked"{/if} > 
                                    开启 <input type="radio" name="allow_register" value="1" {if $siteinfo['allow_register'] == 1} checked="checked"{/if} >
                                </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="allow_login" class="layui-form-label">
                                开启登录</label>
                            <div class="layui-input-inline">
                                关闭 <input type="radio" name="allow_login" value="2" {if $siteinfo['allow_login'] == 2} checked="checked"{/if} > 
                                    开启 <input type="radio" name="allow_login" value="1" {if $siteinfo['allow_login'] == 1} checked="checked"{/if} >
                                </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="allow_comment" class="layui-form-label">
                                开启评论</label>
                            <div class="layui-input-inline">
                                关闭 <input type="radio" name="allow_comment" value="2" {if $siteinfo['allow_comment'] == 2} checked="checked"{/if} > 
                                    开启 <input type="radio" name="allow_comment" value="1" {if $siteinfo['allow_comment'] == 1} checked="checked"{/if} >
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="show_commentlist" class="layui-form-label">
                                显示评论</label>
                            <div class="layui-input-inline">
                                关闭 <input type="radio" name="show_commentlist" value="2" {if $siteinfo['show_commentlist'] == 2} checked="checked"{/if} > 
                                    开启 <input type="radio" name="show_commentlist" value="1" {if $siteinfo['show_commentlist'] == 1} checked="checked"{/if} >
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="site_copyright" class="layui-form-label">
                                网站版权</label>
                            <div class="layui-input-inline">
                                <input type="text" id="site_copyright" name="site_copyright" required="" lay-verify="title" autocomplete="off" class="layui-input" value="{$siteinfo.site_copyright}"></div>
                        </div>
                        <div class="layui-form-item">
                            <label for="site_beian" class="layui-form-label">
                                网站备案</label>
                            <div class="layui-input-inline">
                                <input type="text" id="site_beian" name="site_beian" required="" lay-verify="title" autocomplete="off" class="layui-input" value="{$siteinfo.site_beian}"></div>
                        </div>
                        <div class="layui-form-item">
                            <label for="site_version" class="layui-form-label">
                                系统版本号</label>
                            <div class="layui-input-inline">
                                <input type="text" id="site_version" name="site_version" required="" lay-verify="title" autocomplete="off" class="layui-input" value="{$siteinfo.site_version}"></div>
                        </div>
                        <div class="layui-form-item">

                            <label for="L_repass" class="layui-form-label"></label>
                            <button class="layui-btn" lay-filter="add" type="button" lay-submit="">
                                保存
                            </button>

                            <!-- <button class="layui-btn" lay-filter="add" lay-submit="">修改</button> -->
                        </div>
                    </form>
                </div>
                


            </div>
        </div>
    </div>
</body>


</html>

<script>
    //禁用Enter键
    document.onkeydown = function (e) {
        //捕捉回车事件
        var ev = (typeof event != 'undefined') ? window.event : e;
        if (ev.keyCode == 13 || event.which == 13) {
            return false;
        }
    };

    layui.use(['laydate', 'form'],
        function () {
            var laydate = layui.laydate;
            var form = layui.form;

            //监听提交
            form.on('submit(add)',
                function(data) {
                    $('.layui-btn').attr("disabled", true);
                    //console.log(data.field);                    //发异步，把数据提交给php
                    $.ajax({
                        url : "/admins/system/website",
                        type : "post",
                        data : data.field,
                        success : function(response, status, xhr){
                            if(response.status == 200){
                                console.log(response.data);
                                layer.alert("保存成功", {icon: 6},function () {
                                    //关闭当前frame
                                    xadmin.close();

                                    // 可以对父窗口进行刷新 
                                    xadmin.father_reload();
                                });
                            }else if(response.status == 400){
                                alert(response.msg);
                                $('#user-btn').removeAttr("disabled");
                            }
                        },
                        error : function(xhr, errorText, errorStatus){
                            console.log(xhr.status + ':' + xhr.statusText);
                            $('#user-btn').removeAttr("disabled");
                        }
                    });
                    return false;
                });

        });


</script>